home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / bb212src / bbbinm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-12-22  |  3.3 KB  |  97 lines

  1. (*===========================================================================*)
  2. (* Binary Xfer miscellanous routines                                         *)
  3. (*                                                                           *)
  4. (*   Copyright 1989 by H. Roy Engehausen.  All rights reserved.              *)
  5. (*                                                                           *)
  6. (*===========================================================================*)
  7.  
  8. (*===========================================================================*)
  9. (* Do mess                                                                   *)
  10. (*===========================================================================*)
  11.  
  12. PROCEDURE do_mess_local(mess_no : BYTE);
  13.  
  14.   VAR
  15.     pt : POINTER;
  16.     s  : STRING;
  17.  
  18.   BEGIN;
  19.     pt := find_task_mem_addr('$1');
  20.     IF pt = NIL THEN
  21.       set_dollar1_parm(@bin_mode);
  22.     s := get_message(mess_no);
  23.     window_write(p, s);
  24.   END;
  25.  
  26. PROCEDURE do_mess (mess_no : BYTE);
  27.  
  28.   VAR
  29.     pt : POINTER;
  30.  
  31.   BEGIN;
  32.     IF conv_sw THEN
  33.       do_mess_local(mess_no)
  34.     ELSE
  35.       BEGIN;
  36.         pt := find_task_mem_addr('$1');
  37.         IF pt = NIL THEN
  38.           set_dollar1_parm(@bin_mode);
  39.         send_message(mess_no);
  40.       END;
  41.   END;
  42.  
  43. (*===========================================================================*)
  44. (* Flush any input buffers                                                   *)
  45. (*===========================================================================*)
  46.  
  47. PROCEDURE flush_input_buffers;
  48.   BEGIN;
  49.     WHILE active_tcb^.c_input <> NIL DO
  50.       del_c_string(active_tcb);
  51.   END;
  52.  
  53. (*===========================================================================*)
  54. (* Common code for clean up                                                  *)
  55. (*===========================================================================*)
  56.  
  57. PROCEDURE close_things_up;
  58.  
  59.   VAR
  60.     io_code : INTEGER;
  61.  
  62.   BEGIN;
  63.  
  64.     (*-----------------------------------------------------------------------*)
  65.     (* Obtain the interrupt semaphore                                        *)
  66.     (*-----------------------------------------------------------------------*)
  67.  
  68.     get_semaphore(semaphore_interrupts, sem_exclusive, FALSE);
  69.  
  70.     (*-----------------------------------------------------------------------*)
  71.     (* Close up the file element if still here and thorw it away             *)
  72.     (*-----------------------------------------------------------------------*)
  73.  
  74.     IF active_tcb^.io_fe <> NIL THEN
  75.       BEGIN;
  76.         {$I-}
  77.         CLOSE(active_tcb^.io_fe^.fe_bin);
  78.         io_code := IORESULT;
  79.         {$I+}
  80.         DISPOSE(active_tcb^.io_fe);
  81.         active_tcb^.io_fe := NIL;
  82.       END;
  83.  
  84.     (*-----------------------------------------------------------------------*)
  85.     (* Drop the interrupt semaphore                                          *)
  86.     (*-----------------------------------------------------------------------*)
  87.  
  88.     free_semaphore(semaphore_interrupts);
  89.  
  90.     (*-----------------------------------------------------------------------*)
  91.     (* Flush things                                                          *)
  92.     (*-----------------------------------------------------------------------*)
  93.  
  94.     read_flush;
  95.  
  96.   END;
  97.